# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -mcpu=gfx908 -run-pass=regbankselect -regbankselect-fast -verify-machineinstrs %s -o - | FileCheck %s
# RUN: llc -march=amdgcn -mcpu=gfx908 -run-pass=regbankselect -regbankselect-greedy -verify-machineinstrs %s -o - | FileCheck %s

---
name: copy_s32_vgpr_to_vgpr
legalized: true

body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: copy_s32_vgpr_to_vgpr
    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; CHECK: $vgpr0 = COPY [[COPY]](s32)
    %0:_(s32) = COPY $vgpr0
    $vgpr0 = COPY %0

...

---
name: copy_s32_sgpr_to_sgpr
legalized: true

body: |
  bb.0:
    liveins: $sgpr0
    ; CHECK-LABEL: name: copy_s32_sgpr_to_sgpr
    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; CHECK: $sgpr0 = COPY [[COPY]](s32)
    %0:_(s32) = COPY $sgpr0
    $sgpr0 = COPY %0

...

---
name: copy_s32_sgpr_to_vgpr
legalized: true

body: |
  bb.0:
    liveins: $sgpr0
    ; CHECK-LABEL: name: copy_s32_sgpr_to_vgpr
    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; CHECK: $vgpr0 = COPY [[COPY]](s32)
    %0:_(s32) = COPY $sgpr0
    $vgpr0 = COPY %0

...

---
name: copy_s32_vgpr_to_agpr
legalized: true

body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: copy_s32_vgpr_to_agpr
    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; CHECK: $agpr0 = COPY [[COPY]](s32)
    %0:_(s32) = COPY $vgpr0
    $agpr0 = COPY %0

...

---
name: copy_s32_sgpr_to_agpr
legalized: true

body: |
  bb.0:
    liveins: $sgpr0
    ; CHECK-LABEL: name: copy_s32_sgpr_to_agpr
    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; CHECK: $agpr0 = COPY [[COPY]](s32)
    %0:_(s32) = COPY $sgpr0
    $agpr0 = COPY %0

...

---
name: copy_s32_agpr_to_vgpr
legalized: true

body: |
  bb.0:
    liveins: $agpr0
    ; CHECK-LABEL: name: copy_s32_agpr_to_vgpr
    ; CHECK: [[COPY:%[0-9]+]]:agpr(s32) = COPY $agpr0
    ; CHECK: $vgpr0 = COPY [[COPY]](s32)
    %0:_(s32) = COPY $agpr0
    $vgpr0 = COPY %0

...

---
name: copy_s32_agpr_to_agpr
legalized: true

body: |
  bb.0:
    liveins: $agpr0
    ; CHECK-LABEL: name: copy_s32_agpr_to_agpr
    ; CHECK: [[COPY:%[0-9]+]]:agpr(s32) = COPY $agpr0
    ; CHECK: $agpr0 = COPY [[COPY]](s32)
    %0:_(s32) = COPY $agpr0
    $agpr0 = COPY %0

...

---
name: copy_s1_sgpr_to_vcc_preassigned
legalized: true

body: |
  bb.0:
    liveins: $sgpr0
    ; CHECK-LABEL: name: copy_s1_sgpr_to_vcc_preassigned
    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
    ; CHECK: [[COPY1:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
    ; CHECK: S_ENDPGM 0, implicit [[COPY1]](s1)
    %0:sgpr(s32) = COPY $sgpr0
    %1:sgpr(s1) = G_TRUNC %0
    %2:vcc(s1) = COPY %1
    S_ENDPGM 0, implicit %2
...

---
name: copy_s1_vgpr_to_vcc_preassigned
legalized: true

body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: copy_s1_vgpr_to_vcc_preassigned
    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
    ; CHECK: [[COPY1:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
    ; CHECK: S_ENDPGM 0, implicit [[COPY1]](s1)
    %0:vgpr(s32) = COPY $vgpr0
    %1:vgpr(s1) = G_TRUNC %0
    %2:vcc(s1) = COPY %1
    S_ENDPGM 0, implicit %2
...

---
name: copy_s1_sgpr_to_vcc
legalized: true

body: |
  bb.0:
    liveins: $sgpr0
    ; CHECK-LABEL: name: copy_s1_sgpr_to_vcc
    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
    ; CHECK: [[COPY1:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
    ; CHECK: S_ENDPGM 0, implicit [[COPY1]](s1)
    %0:_(s32) = COPY $sgpr0
    %1:_(s1) = G_TRUNC %0
    %2:vcc(s1) = COPY %1
    S_ENDPGM 0, implicit %2
...


---
name: copy_s1_vgpr_to_vcc
legalized: true

body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: copy_s1_vgpr_to_vcc
    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
    ; CHECK: [[COPY1:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
    ; CHECK: S_ENDPGM 0, implicit [[COPY1]](s1)
    %0:_(s32) = COPY $vgpr0
    %1:_(s1) = G_TRUNC %0
    %2:vcc(s1) = COPY %1
    S_ENDPGM 0, implicit %2
...
